package com.cet.lxf.oop.test05;

import java.math.BigDecimal;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-06-28 16:29
 **/
public class Main03 {
    public static void main(String[] args) {
        BigDecimal d1 = new BigDecimal("123.4500");
        BigDecimal d2 = d1.stripTrailingZeros();
        // 4
        System.out.println(d1.scale());
        // 2,因为去掉了00
        System.out.println(d2.scale());

        BigDecimal d3 = new BigDecimal("1234500");
        BigDecimal d4 = d3.stripTrailingZeros();
        // 0
        System.out.println(d3.scale());
        // -2
        System.out.println(d4.scale());
    }
}
